﻿$(function () {





    // Generate datepicker panel
    $(".datepicker").datepicker();

    /* Button click functions */


    /* Button : Eng Dept Support Misc Support */
    $("#btnEngDeptSupportMisc").click(function (evt) {
        // Enter reason
        var reason = GetReason("Please enter the reason you are logging onto Eng Dept Support/Misc (50 chrs max)", "Please enter reason", 50);

        // Clock On to activity
        if (reason != null && reason != "") {
            ClockOn(2, $("#btnEngDeptSupportMisc").text(), reason);
        }
    });


    /* ---------------------------- */

    /* Button : General Meeting */
    $("#btnEndOfDay").click(function (evt) {
        var r = confirm("Do you want to clock off your current task ?");
        if (r == true) {
            EndOfDay();
        }

    });
    /* ---------------------------- */

    /* Dropdownlist : Project */
    $("select#ddlProject").change(function (evt) {
        GetProjectData();
    });
    /* ---------------------------- */

    $("select#ddlEngineers").change(function (evt) {
        if ($("select#ddlEngineers").val() != "-1" && $("select#ddlEngineers").val() != "" && $("select#ddlEngineers").val() != null) {
            // Get user id
            var userId = $("select#ddlEngineers").val();
            // Get project that belong to user
            GetProjectListByUserId(userId);
        }
        else {
            // Clear all grid's data
            ClearGridData();
        }
    });



    $(".requesttoken input").removeAttr("disabled");



});